package test;

import static org.junit.Assert.assertEquals;

import org.junit.Before;
import org.junit.Test;

import entity.Data;
import entity.IData;

public class UnittestData {
	
	IData data;

	@Before
	public void setUp() throws Exception {
		data = new Data();
	}

	@Test
	public void testGetWeight() {
		assertEquals(0, data.getWeight(), 0.000001);
	}

	@Test
	public void testSetWeight() {
		data.setWeight(5);
		assertEquals(5, data.getWeight(), 0.000001);
		data.setWeight(4.5);
		assertEquals(4.5, data.getWeight(), 0.000001);
	}

	@Test
	public void testGetTaraWeight() {
		assertEquals(0, data.getTaraWeight(), 0.000001);
	}

	@Test
	public void testSetTaraWeight() {
		data.setTaraWeight(5);
		assertEquals(5, data.getTaraWeight(), 0.000001);
		data.setTaraWeight(5.55);
		assertEquals(5.55, data.getTaraWeight(), 0.000001);
	}
	
	@Test
	public void setDisplay(){
		data.setDisplay("test1");
		assertEquals("test1", data.getDisplay());
	}
	
	@Test
	public void setP111(){
		data.setP111("test1");
		assertEquals("test1", data.getP111());
		}
	
	@Test
	public void setRM20(){
		data.setRM20("test1", "test2", "test3");
		assertEquals("test1", data.getRM201());
		assertEquals("test2", data.getRM202());
		assertEquals("test3", data.getRM203());
	}
	
	@Test
	public void getDisplay(){
		assertEquals("", data.getDisplay());
		data.setDisplay("test1");
		assertEquals("test1", data.getDisplay());
	}
	
	@Test
	public void getP111() {
		assertEquals("", data.getP111());
		data.setP111("test1");
		assertEquals("test1", data.getP111());	
		}

	@Test
	public void getRM201() {
		assertEquals("", data.getRM201());
		data.setRM20("test1", "test2", "test3");
		assertEquals("test1", data.getRM201());
	}

	@Test
	public void getRM202() {
		assertEquals("", data.getRM202());
		data.setRM20("test1", "test2", "test3");
		assertEquals("test2", data.getRM202());
	}

	@Test
	public void getRM203() {
		assertEquals("", data.getRM203());
		data.setRM20("test1", "test2", "test3");
		assertEquals("test3", data.getRM203());
	}
}